package cn.fj.game;

import java.awt.Graphics;
import java.awt.Image;

//爆炸类
public class Explode {
	double x, y;  //设置爆炸的位置
	
	static Image[] imgs = new Image[16];    //设置为静态的避免重复的new 对象
	static {//对图片进行加载，这里还没有把图片画到界面了
		for (int i = 0; i < 16; i++) {
			imgs[i] = GameUtil.getImage("images/explode/e" + (i + 1) + ".gif");   //图片的命名是1-16所以i+1了
			imgs[i].getWidth(null);
		}
	}

	int count;

	public void draw(Graphics g) {   //这里才把图片画到界面里   并且轮播16张图片
		if (count <= 15) {
			g.drawImage(imgs[count], (int) x, (int) y, null);
			count++;
		}
	}

	public Explode(double x, double y) {
		this.x = x;
		this.y = y;
	}
}